class Animal {
    public String name;
    public int age;
    public String color;

    static {
        System.out.println("Animal的静态代码块！");
    }

    {
        System.out.println("Animal的实例代码块！");
    }

    public Animal(String name) {
        this.name = name;
        System.out.println("Animal(String)");
    }

    public void eat() {
        System.out.println(name + "正在吃饭！");
    }
}

class Dog extends Animal {
    public Dog(String name) {
        super(name);
    }

    static {
        System.out.println("Dog的静态代码块！");
    }

    {
        System.out.println("Dog的实例代码块！");
    }

    public void wangWang() {
        System.out.println("汪汪叫！");
    }
}

class Cat extends Animal {
    public Cat(String name) {
        super(name);
    }

    public void miMi() {
        System.out.println("喵喵叫");
    }
}

public class Test {
    public static void main(String[] args) {
        Dog dog1 = new Dog("dog");
        System.out.println("==============");
        Dog dog2 = new Dog("dog");

    }

    public static void main2(String[] args) {
        Animal animal1 = new Animal("animal");
        Animal animal2 = new Animal("animal");

    }

    public static void main1(String[] args) {
        Dog dog = new Dog("小狗");
        dog.eat();
        dog.wangWang();

        Cat cat = new Cat("小猫");
        cat.eat();
        cat.miMi();
    }

}
